package tests;

import common.Utils;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.io.IOException;

public class PageByNoLogin extends Utils {
    public static String listurl="http://43.138.73.175:8080/book_list.html";
    public static String updateurl="http://43.138.73.175:8080/book_update.html";
    public static String addurl="http://43.138.73.175:8080/book_add.html";
    public PageByNoLogin(){
        super("");
    }
    public void ListPageByNoLogin() throws IOException {
        driver.get(listurl);
        //通过查看页面元素是否存在来检查是否跳转到登录页
        driver.findElement(By.cssSelector("body > div > div.container-pic > img"));
        //登录输入框
        driver.findElement(By.cssSelector("body > div > div.login-dialog"));
    }
//    public void UpdatePageByNoLogin() throws IOException {
//        driver.get(updateurl);
//        WebDriverWait wait = new WebDriverWait(driver, 10);
//        wait.until(ExpectedConditions.titleContains("博客登陆页"));
//        String expect =driver.getTitle();
//        getScreenShot(getClass().getName());
//        assert expect.equals("博客登陆页");
//        driver.quit();
//    }
//    public void AddPageByNoLogin() throws IOException {
//        driver.get(addurl);
//        WebDriverWait wait = new WebDriverWait(driver, 10);
//        wait.until(ExpectedConditions.titleContains("博客登陆页"));
//        String expect =driver.getTitle();
//        getScreenShot(getClass().getName());
//        assert expect.equals("博客登陆页");
//        driver.quit();
//    }
}
